import logging
import os
import datetime
from logging import handlers
#today=str(datetime.date.today())
levelformat="[%(asctime)s]-[%(process)d]-[%(thread)d:%(threadName)s]-[%(funcName)s.%(lineno)d]-[%(levelname)s]:%(message)s"
#logpath=os.getcwd()
#print logpath+'/../log/'+today+'.main.log'
class Logger():
    def __init__(self,name,filepath):
        self.__name = name
        self.__logger = logging.getLogger(__name__)
        self.__logger.setLevel(logging.INFO)
        #self.__handler=logging.FileHandler(filepath)
        self.__handler=handlers.TimedRotatingFileHandler(filepath,when='MIDNIGHT',interval=1, backupCount=0)
        self.__handler.suffix = "%Y-%m-%d"
        self.__handler.setLevel(logging.INFO)
        self.__formatter=logging.Formatter(levelformat)
        self.__handler.setFormatter(self.__formatter)
        self.__logger.addHandler(self.__handler)
    def getLogger(self):
        return self.__logger
